import SnakeGameCenter, { GameRaidoType } from "../important/SnakeGameCenter";
import LogTool from "./LogTool";
const { ccclass, property, requireComponent } = cc._decorator;
@ccclass
@requireComponent(cc.Canvas)
export default class FitCanvas extends cc.Component {
    public onLoad(): void {
        let canvas = this.node.getComponent(cc.Canvas);
        if (!canvas)
            return;
        switch (SnakeGameCenter.GameRaidoType) {
            case GameRaidoType.RadioLang:
                LogTool.Log("屏幕 比例超出正规值");
                canvas.fitHeight = true;
                canvas.fitWidth = false;
                this.node.x = cc.winSize.width / 2;
                this.node.y = cc.winSize.height / 2;
                cc.view.setDesignResolutionSize(720, 1560, 2);
                break;
            case GameRaidoType.RadioNormal:
                LogTool.Log("屏幕 正常比例");
                canvas.fitHeight = false;
                canvas.fitWidth = true;
                this.node.x = cc.winSize.width / 2;
                cc.view.setDesignResolutionSize(720, 1280, 2);
                break;
            case GameRaidoType.RadioApplePaid:
                LogTool.Log("3:2 的平板");
                canvas.fitHeight = false;
                canvas.fitWidth = true;
                this.node.x = cc.winSize.width / 2;
                cc.view.setDesignResolutionSize(960, 1280, 2);
                break;
            case GameRaidoType.RadioNormalPaid:
                LogTool.Log("16:10 的平板");
                canvas.fitHeight = true;
                canvas.fitWidth = false;
                this.node.y = cc.winSize.height / 2;
                this.node.x = cc.winSize.width / 2;
                cc.view.setDesignResolutionSize(800, 1280, 2);
                break;
            default:
                break;
        }
    }
}
